import Vue from "vue";
import VueRouter from "vue-router";

Vue.use(VueRouter);

const routes = [
  {
    path: '/myreadsgl',
    name: 'Myreadsgl',
    component: () => import('../views/Myreadsgl.vue'),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: '/myupset',
    name: 'Myupset',
    component: () => import('../views/Myupset.vue'),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: '/myreds',
    name: 'Myreds',
    component: () => import('../views/Myreds.vue'),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: '/mydz',
    name: 'Mydz',
    component: () => import('../views/Mydz.vue'),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/myreadds",
    name: "Myreadds",
    component: () => import("../views/Myreadds.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/vipbd",
    name: "Vipbd",
    component: () => import("../views/Vipbd.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/mygrzl",
    name: "MyGrzl",
    component: () => import("../views/MyGrzl.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/vipshop",
    name: "Vipshop",
    component: () => import("../views/Vipshop.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/vip",
    name: "Vip",
    component: () => import("../views/Vip.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/details",
    name: "Details",
    component: () => import("../views/Details.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/myfenlei",
    name: "Myfefnlei",
    mata: {
      keepAlive:true,
    },
    component: () => import("../views/Myfenlei.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/login",
    name: "Login",
    component: () => import("../views/Login.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/register",
    name: "Register",
    component: () => import("../views/Register.vue"),
    meta:{
      keepAlive:false,
    },
  },
  {
    path: "/myshopcar",
    name: "Myshopcar",
    mata: {
      keepAlive: true,
    },
    component: () => import("../views/Myshopcar.vue"),
  },
  {
    path: "/mymessage",
    name: "Mymessage",
    mata: {
      keepAlive: true,
    },
    component: () => import("../views/Mymessage.vue"),
  },
  {
    path: "/",
    name: "Home",
    component: () => import("../views/Home.vue"),
    meta:{
      keepAlive:true,
    },
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
  scrollBehavior (to,from,savePosition){
    if(from.name=="Home"&&to.name=="Home")
     { return{x:0,y:0}
    }else{
      return savePosition
    }
  }
});

export default router;
